package com.es.heap;

import com.es.queue.AbstractQueue;

/**
 * @author 二十
 * @since 2022/1/18 9:45 下午
 */
public class PriorityQueue<E extends Comparable<E>> extends AbstractQueue<E> {

    private AbstractMaxHeap<E> heap;

    public PriorityQueue() {
        heap = new MaxHeap<>();
    }

    @Override
    public void enqueue(E e) {
        heap.add(e);
    }

    @Override
    public E dequeue() {
        return heap.deleteMax();
    }

    @Override
    public E getFront() {
        return heap.findMax();
    }

    @Override
    public int getSize() {
        return heap.getSize();
    }

    @Override
    public boolean isEmpty() {
        return heap.isEmpty();
    }
}
